package com.heima.media.controller;

import com.heima.common.dto.ResponseResult;
import com.heima.media.dto.WmSensitiveDto;
import com.heima.media.service.IWmSensitiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 敏感词信息表 前端控制器
 * </p>
 *
 * @author djc
 * @since 2022-10-03
 */
@RestController
@RequestMapping("/api/v1/sensitive")
@Api(tags = "敏感词信息表接口")
@CrossOrigin
public class WmSensitiveController{

    @Autowired
    private IWmSensitiveService wmSensitiveService;

    @PostMapping("/list")
    @ApiOperation(value = "listByPage", notes = "敏感词列表展示")
    @ApiModelProperty(name = "dto", dataType = "WmSensitiveDto", required = true)
    public ResponseResult list(@RequestBody WmSensitiveDto dto) {
        return wmSensitiveService.listByPage(dto);
    }


    @PostMapping
    @ApiOperation(value = "saveSensitive", notes = "新增敏感词")
    @ApiModelProperty(name = "dto", dataType = "WmSensitiveDto", required = true)
    public ResponseResult saveSensitive(@RequestBody WmSensitiveDto dto) {

        return wmSensitiveService.saveSensitive(dto);
    }

}
